package com.gym.openapi.web.controller;

import com.gym.openapi.common.ResponseResult;
import com.gym.openapi.common.ResultTable;
import com.gym.openapi.entity.UserToken;
import com.gym.openapi.services.Tokenservices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ming
 * 2021/11/26
 * description:token管理dd
 */
@RestController
@RequestMapping("/token")
public class TokenController {
    @Autowired
    private Tokenservices tokenservices;

    /**
     *@author:ming
     *@Date: 2021/11/27
     *@description:页面显示 搜索栏搜索
     */
    @RequestMapping("/table")
    public ResultTable tokenTable(@RequestParam(defaultValue = "1")Integer page,
                                  @RequestParam(defaultValue = "10")Integer limit, String accessToken) {

        ResultTable rt= tokenservices.tokenTable(page,limit,accessToken);
        System.out.println("rt"+rt);
        return rt;
    }
    /**
     *@author:ming
     *@Date: 2021/11/27
     *@description:批量删除
     */
    @RequestMapping("/del")
    public ResponseResult del(Integer[] ids) {
        return  tokenservices.del(ids);
    }

    /**
     *@author:ming
     *@Date: 2021/11/27
     *@description:编辑修改
     */
    @RequestMapping("/update")
    public ResponseResult update(UserToken t) {
        return tokenservices.update(t);
    }
    /**
     *@author:ming
     *@Date: 2021/11/27
     *@description:添加
     */
    @RequestMapping("/add")
    public ResponseResult add(UserToken t){
        return tokenservices.add(t);
    }

    }
